package jp.gr.java_conf.genzo.wifinotify.util;

import jp.gr.java_conf.genzo.wifinotify.WifiNotifyApp;
import android.content.Context;
import android.location.Criteria;
import android.location.LocationListener;
import android.location.LocationManager;

public class LocationUtil {

	private LocationUtil() {
	}

	public static void getLoaction(LocationListener listener) {

		LocationManager lm = (LocationManager) WifiNotifyApp.getApp().getSystemService(Context.LOCATION_SERVICE);
		// 取得条件
		Criteria cri = new Criteria();
//		cri.setAccuracy(Criteria.ACCURACY_COARSE);
		cri.setSpeedRequired(false);
		cri.setAltitudeRequired(false);
		String provider = lm.getBestProvider(cri, true);
		if (provider == null){
			provider = LocationManager.NETWORK_PROVIDER;
		}
		lm.requestLocationUpdates(provider, 0, 0, listener);
	}

}
